<template>
	<div class="chinese">
		<div class="morelist">
			<template v-for="(item,index) in musiclist">
				<div @click="musicdetail(item.id)" class="musicnew">
					<div class="pic_box">
						<img :src="item.coverImgUrl" alt="" />
						<div class="numbers">
							<i class="iconfont icon-bofang1"></i>
							<span>{{item.playCount}}</span>
						</div>
					</div>
					<p>
						{{item.name}}
					</p>
				</div>
			</template>
		</div>
	</div>
</template>

<script>
	export default {
		name: "musiclist",
		data() {
			return {
				musiclist: [],

			}
		},
		created() {
			this.$http.get("/top/playlist", {
				params: {
					cat: "华语"
				}
			}).then(res => {
				console.log(res)
				res.data.playlists.forEach((val, index) => {
					
					if(val.playCount > 10000) {
						val.playCount = parseInt(val.playCount / 10000) + "万"
					}

				})
				this.musiclist = res.data.playlists
			})
		},
		methods:{
			musicdetail(id){
				this.$router.push({
					name:"musiclistdetail",
					query:{
						idx:id
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "~@/assets/css/common.scss";
	.chinese{
		.morelist {
			margin: vw(16) 0 0;
			display: flex;
			justify-content: space-between;
			padding: 0 vw(16);
			flex-wrap: wrap;
			.musicnew {
				width: 32%;
				text-align: left;
				font-size: vw(10);
				color: #333;
				margin: vw(10) 0;
				.pic_box {
					width: 100%;
					height: vw(110);
					overflow: hidden;
					position: relative;
					border-radius: vw(6);
					img {
						width: 100%;
					}
					.numbers {
						position: absolute;
						top: 6px;
						right: 6px;
						color: white;
						font-size: vw(10);
						i {
							font-size: vw(6);
						}
					}
				}
				p {
					margin: vw(6) 0 0;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical
				}
			}
		}
	}
</style>